<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */
?>

<div class="form">
<script src="<?php echo Yii::app()->baseUrl. '/ckeditor/ckeditor.js'; ?>"></script>
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
        'htmlOptions' => array('enctype'=>'multipart/form-data'),
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'username'); ?>
		<?php echo $form->textField($model,'username',array('size'=>30,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'username'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'password'); ?>
		<?php echo $form->passwordField($model,'password',array('size'=>30,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'password'); ?>
	</div>
        
        <div class="row">
		<?php echo $form->labelEx($model,'password_repeat'); ?>
		<?php echo $form->passwordField($model,'password_repeat',array('size'=>30,'maxlength'=>50)); ?>
		<?php echo $form->error($model,'password_repeat'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'email'); ?>
		<?php echo $form->textField($model,'email',array('size'=>30,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'trangthai'); ?>
		<?php echo $form->dropDownList($model, 'trangthai', $model->getTrangthai()); ?>
		<?php echo $form->error($model,'trangthai'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'diachi'); ?>
		<?php echo $form->textArea($model,'diachi',array('id'=>'ckeditor')); ?>
		<?php echo $form->error($model,'diachi'); ?>
	</div>
        <script type="text/javascript">
        CKEDITOR.replace('ckeditor');
        </script>


	<div class="row">
		<?php echo $form->labelEx($model,'gioitinh'); ?>
		<?php echo $form->dropDownList($model, 'gioitinh', $model->getGioitinh()); ?>
		<?php echo $form->error($model,'gioitinh'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'avatar'); ?>
		<?php echo CHtml::activeFileField($model, 'avatar'); ?>
		<?php echo $form->error($model,'avatar'); ?>
	</div>
        
        <?php if($model->isNewRecord!='1') ?>
        <div class="row"   >
            <?php echo CHtml::image(Yii::app()->request->baseUrl. '/images/avatar1/' .$model->avatar,"avatar",array("width"=>200)); ?>
        </div>
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->